#include<stdio.h>
#include<string.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>


int main()
{
    printf("stdin:%d\n",stdin->_fileno);
    printf("stdout:%d\n",stdout->_fileno);
    printf("stderr:%d\n",stderr->_fileno);

    //char input[16];
    //ssize_t n = read(0,input,sizeof input);
    //if(n>0)
    //{
    //    input[n] = '\0';
    //    printf("%s\n",input);
    //}
    //else 
    //{
    //    printf("未读取到数据\n");
    //}

    //int a = 10;
    //fscanf(stdin,"%d",&a);
    //printf("%d\n",a);


    //fprintf(stdout,"hello stdout\n");
    //const char*s = "hello num:1\n";
    //write(1,s,strlen(s));


    //umask(0);
    //int fd = open("log.txt",O_WRONLY|O_CREAT,0666);
    //int fd = open("log.txt",O_WRONLY|O_CREAT|O_TRUNC,0666);
    //int fd = open("log.txt",O_WRONLY|O_CREAT,0666);
    //int fd = open("log.txt",O_WRONLY|O_CREAT|O_APPEND,0666);
    //int fd = open("log.txt",O_RDONLY);
    //if(fd<0)
    //{
    //    perror("open:");
    //    return 1;
    //}
    //

    //printf("open success,fd:%d\n",fd);


   //// const char* s1 = "test:: write\n";
    //
    ////const char* s1 = "ab\n";    
    ////write(fd,s1,strlen(s1));
    //
    //char buffer[64];
    //memset(buffer,'\0',sizeof buffer);
    //read(fd,buffer,sizeof buffer);
    //printf("%s",buffer);
    //close(fd);

    return 0;
}
